package lesson3.slides.math;

import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;  

public class Division {

    public static void main(String[] args) {
        MathContext mc =
                new MathContext(10, RoundingMode.HALF_EVEN);
        BigDecimal bd1 = BigDecimal.ONE;
        BigDecimal bd2 = new BigDecimal(3L);
// Division without a rounding context would throw an
// exception because 1/3 requires an infinite number
// of decimal places to represent accurately
        BigDecimal bd3 = bd1.divide(bd2, mc);
        System.out.println("one third is: " + bd3);

    }
}
